/**
 * 
 */
package com.laozhao.deliveryManager.control.master;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import com.laozhao.deliveryManager.control.MainWindowsControl;
import com.laozhao.deliveryManager.view.master.UserUI;

/**
 * @author laozhao
 *
 */
public class UserControl extends UserUI implements ActionListener {

	public MainWindowsControl mc; 
	
	/**
	 * 
	 */
	public UserControl(MainWindowsControl mc) {
		super();
		this.mc = mc;
//		setUser(mc.user);
	}


	
	
//
//	public void run()  {
//		while(true){
//			System.out.println("^^^^search in Thread2 :"+Thread.getDefaultUncaughtExceptionHandler() );
//			try {
//				Thread.sleep(300);
//			} catch (InterruptedException e) {
//				// TODO Auto-generated catch block
//				e.printStackTrace();
//				System.out.println("^^^^the  Thread2 was error  " );
//			}
//		}
//		class InUser implements ActionListener{
//			InUser(){
////				searchButton.addActionListener(this);
////				addButton.addActionListener(this);
////				delButton.addActionListener(this);
////				saveButton.addActionListener(this);
//			}
//
//			public void actionPerformed(ActionEvent e) {
//				if(e.getSource() == searchButton){
////					search();
//				}
//				
//			}
//			public void search() {
//				System.out.println("^^^^search in Thread2 :"+Thread.getDefaultUncaughtExceptionHandler() );
//				
//				
//			}
//			
//		}
//	}
	public void init(){
		super.init();
		searchButton.addActionListener(this);
	}


	public class search extends Thread {
		private String name;
		public search(String name){
			this.name = name;
		}

		public void run(){
			Double i = new Double(100000);
			while(i > 0){
				System.out.println("^^^^search in Thread2 :"+ i );
//				if(mc.tabContainer.getSelectedComponent().getName().equals(name)){
//					mc.progressBar.setMaximum(100);
//					mc.progressBar.setMinimum(0);
//					mc.progressBar.setValue((new Double(i/1000)).intValue());
//					i--;
//				}
				
			}
		}
	}
	public void stop(){
		
	}

	public void actionPerformed(ActionEvent e) {
		if(e.getSource() == searchButton){
			search();
			new search(this.getName()).start();
		}
		
	}
	public void search() {
		System.out.println("^^^^search in Thread1 :"+Thread.getDefaultUncaughtExceptionHandler() );
		
		
	}
}
